﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using dts = ControlIP.DataTypes;
using bs = ControlIp.Bussiness;

namespace ControlIPApp
{
    /// <summary>
    /// Interaction logic for ucConsultRegisters.xaml
    /// </summary>
    public partial class ucConsultRegisters : UserControl
    {
        public ucConsultRegisters()
        {
            InitializeComponent();

            DateTime now = DateTime.Now;
            dtEnd.SelectedDate = now;

            CultureInfo defaultCultureInfo = CultureInfo.CurrentCulture;
            DayOfWeek firstDay = defaultCultureInfo.DateTimeFormat.FirstDayOfWeek;

            DateTime firstDayWeek;

            while (now.DayOfWeek != firstDay )
            {
                now = now.AddDays(-1);
            }

            dtBegin.SelectedDate = now;

            //DateTime firstDayInWeek = dayInWeek.Date;

        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {

              var list = bs.Entry.GetEntryByUser("vviana");

        
            dataGrid1.DataContext = list;

        }

        private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MessageBox.Show("Vitor a e tal");
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {

            //Workbook workbook = new Workbook();
            //workbook.LoadFromFile(@"..\..\ProductInfo.xlsx", ExcelVersion.Version2010);
            //Worksheet sheet1 = workbook.Worksheets[0];


        }
    }
}
